// Copyright 2020 ADTIMING TECHNOLOGY COMPANY LIMITED
// Licensed under the GNU Lesser General Public License Version 3

package com.adtiming.om.server.cp.dto;

public class BidRequest {

    public String id;  // platform's auction identifier
    public App app;
    public Device device;
    public User user;
    public Imp[] imp;
    public int at = 1; // auction type: 1: First Price, 2: Second Price
    public int tmax;   // auction timeout, ms
    public int test; // 0: normal, 1: test mode (we bid $99.99, but don't pay out)  (optional)
    public Regs regs;

    public static class App {
        public String id;     // publisherApp.appKey of AdTiming
        public String ver;    // app version
        public String bundle; // app bundle (iOS: Numberic ID, Android: Package Name)
    }

    public static class Device {
        public String ua; // device user-agent, required
        public String make;
        public String model;
        public String os; // iOS or Android
        public String osv; // os version
        // Do not send ip or ipv6 if you are requesting bids from the client device
        // For server-side bid requests only, set one of ip or ipv6
        public String ip;   // device IPv4 (optional, server-side bidding only)
        public String ipv6; // device IPv6 (optional, server-side bidding only)
        public Integer dnt; // 0: normal, 1: do-not-track
        public Integer lmt; // “Limit Ad Tracking”
        public String language;
        public String carrier;
        public String mccmnc;
        public int connectiontype;
        public String ifa; // ID sanctioned for advertiser use in the clear (i.e., not hashed).

        public Geo geo;   // only usefull when debug is on

        public static class Geo {
            public int type;
            public String country;
            public String region;
            public String city;
        }
    }

    public static class User {
        public String id; // Audience Network Identity Token, generated by sdk getBidderToken()
    }

    public static class Imp {
        public String id; // platform's identifier for this slot auction, bid_req_id
        public String tagid; // placementId, (required)

        public AdType banner;
        public AdType $native;
        public Video video;

        public AdType getNative() {
            return $native;
        }

        public void setNative(AdType $native) {
            this.$native = $native;
        }

        public static class AdType {
            public int w, h;
        }

        public static class Video extends AdType {
            public Integer skip;
        }
    }

    public static class Regs {
        public Integer coppa;
        public Ext ext;

        public static class Ext {
            public Integer gdpr, ccpa;
        }
    }

}
